package cn.wildfire.chat.app.setting;

import android.content.Intent;
import android.text.TextUtils;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.OnClick;
import cn.wildfire.chat.kit.AppService;
import cn.wildfire.chat.kit.R;
import cn.wildfire.chat.kit.WfcBaseActivity;
import cn.wildfire.chat.kit.entry.WalletResult;

public class WalletActivity extends WfcBaseActivity {
    @BindView(R.id.tvBalance)
    TextView tvBalance;
    @Override
    protected int contentLayout() {
        return R.layout.activity_wallet;
    }

    @Override
    protected void afterViews() {
        super.afterViews();
        if (!isDarkTheme()) {
            setTitleBackgroundResource(R.color.white, false);
        }
        AppService.Instance().getWalletInfo(new AppService.WalletCallback() {
            @Override
            public void onUiSuccess(WalletResult data) {
                if (isFinishing()) {
                    return;
                }
                tvBalance.setText("￥ "+ (TextUtils.isEmpty(data.getBalance()) ? "0.00":data.getBalance()));
            }

            @Override
            public void onUiFailure(int code, String msg) {
                if (isFinishing()) {
                    return;
                }
            }
        });
    }

    @Override
    public void onPointerCaptureChanged(boolean hasCapture) {

    }

    @OnClick(R.id.tvUpdatePayPassword)
    public void onClick(){
        Intent intent = new Intent(this,UpdatePayPasswordActivity.class);
        startActivity(intent);
    }
}